package com.diandian.common;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import com.alibaba.fastjson.JSONObject;

/**
 * @description GlobalExceptionHandler, deprecated,see {@link #ErrorFilter }
 * @author TDW
 * @date 2016年12月28日
 *
 */
@Deprecated
@ControllerAdvice
class GlobalExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    public String defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception {
//        ModelAndView mav = new ModelAndView();
//        mav.addObject("exception", e);
//        mav.addObject("url", req.getRequestURL());
//        mav.setViewName(DEFAULT_ERROR_VIEW);
    	JSONObject json = new JSONObject();
        json.put(Constant.RETURN_CODE, Constant.SYS_ERR_CODE);
        json.put(Constant.RETURN_MESSAGE, Constant.RETURN_MESSAGE);//系统异常
        return json.toJSONString();
    }
}